﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="clr-namespace:Bonobo.Reader.Feeds.UI"
    x:Class="Bonobo.Reader.Feeds.UI.FeedItemResourceDictionary"
                    >
    <DataTemplate x:Key="FeedItemTemplate">
        <StackPanel Margin="0 0 0 15">
            <StackPanel.CommandBindings>
                <CommandBinding Command="{x:Static ui:FeedCommands.MarkAsRead}" 
                                Executed="MarkAsReadExecuted" 
                                CanExecute="MarkAsReadCanExecute" />
            </StackPanel.CommandBindings>
            <StackPanel.Resources>
                <Style x:Key="ItemHeaderStyler" TargetType="TextBlock">
                    <Setter Property="FontWeight" Value="Bold" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsRead}" Value="True">
                            <Setter Property="FontWeight" Value="Normal" />
                            <Setter Property="FontStyle" Value="Italic" />
                            <Setter Property="TextBlock.Foreground" Value="Silver" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </StackPanel.Resources>
            <DockPanel>
                <Image Source="Resources/rss.png" 
                       DockPanel.Dock="Left"  
                       Stretch="None" 
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Width="20"/>
                <TextBlock Text="{Binding Title }" 
                       HorizontalAlignment="Left" 
                       Style="{StaticResource ItemHeaderStyler}"
                       TextWrapping="Wrap"  
                       Padding="5 0 0 0"
                       />
            </DockPanel>
            <TextBlock Text="{Binding Text}"
                       TextAlignment="Justify"
                       TextWrapping="Wrap"
                       />
            <TextBlock Text="{Binding DateTime, StringFormat={}{0:hh.mm dd.MM yyyy}}"
                       TextAlignment="Left"
                       TextWrapping="Wrap"                                                   
                       />
            <TextBlock Text="{Binding FeedName}"
                       TextAlignment="Left"
                       TextWrapping="Wrap"                                                   
                       />
            <WrapPanel>
                <Button Command="{x:Static ui:FeedCommands.MarkAsRead}"
                        Content="Mark as read"
                        Width="100"
                        CommandParameter="{Binding}"/>
            </WrapPanel>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>